package com.imooc.web.aspect;

import org.aspectj.lang.ProceedingJoinPoint;
import org.aspectj.lang.annotation.Around;
import org.aspectj.lang.annotation.Aspect;
import org.aspectj.lang.annotation.Pointcut;
import org.springframework.stereotype.Component;

import java.util.Arrays;

/**
 * @author lik
 */
@Aspect
@Component
public class TimeAspect {
    // @Pointcut("execution(* com.imooc.web.*.*(..))")
    // public void cut(){
    //
    // }
    //
    //
    // @Around("execution(* com.imooc.web.controller.*.*(..))")
    // public Object before(ProceedingJoinPoint joinPoint) throws Throwable {
    //     long time = System.currentTimeMillis();
    //     Object proceed = joinPoint.proceed();
    //     long end = System.currentTimeMillis();
    //     System.out.println("TimeAspect耗时"+(time-end));
    //     Object[] args = joinPoint.getArgs();
    //     Arrays.stream(args).forEach(arg-> System.out.println(arg));
    //     return proceed;
    // }
}
